<?php
/**
 * Created by PhpStorm.
 * User: shaowei
 * Date: 2019/4/22
 * Time: 下午8:21
 */

namespace App\Http\Services;



use App\Http\Model\Hint;
use App\Http\Model\User;

class RoomExpServices extends CommonServices
{
    private $modelUser;

    public function __construct(User $user)
    {
        $this->modelUser = $user;
    }

    /**
     * 生成骰子
     * @param $roomId
     * @param $userId
     * @return int
     */
    public function makeDice($roomId, &$userId){
        $user = $this->modelUser->get_current_user();
        if (empty($user)){
            return Hint::LOGIN_OUT;
        }
        $userId = $user['user_id'];
        $diceArr = [37, 38, 39, 40, 41, 42];
        return $diceArr[mt_rand(0, 5)];
    }


    /**
     * 生成举牌
     * @param $roomId
     * @param $userId
     * @return int
     */
    public function makeCard($roomId, &$userId){
        $user = $this->modelUser->get_current_user();
        if (empty($user)){
            return Hint::LOGIN_OUT;
        }
        $userId = $user['user_id'];
        $cardArr =  [27, 28, 29, 30, 31, 32, 33, 34, 35, 36];
        return $cardArr[mt_rand(0, 9)];
    }



}